package com.briup.pts.web.controller;

import com.briup.pts.config.response.Result;
import com.briup.pts.service.AnalysisService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RequestMapping("/analysis")
@RestController
@RequiredArgsConstructor
public class AnalysisController {

    private final AnalysisService service;

    /**
     * 统计栏舍，栏圈，动物数量，冷库数量，员工数量信息接口
     * @return 响应信息
     */
    @GetMapping("/count")
    public Result<Map<String, List<?>>> count(){
        Map<String, List<?>> count = service.count();
        return Result.success(count);
    }

    /**
     * 统计动物体重信息接口
     * @return 响应信息
     */
    @GetMapping("/indexCount")
    public Result<?> indexCount(){
        Map<String, Integer> indexCount = service.indexCount();
        return Result.success(indexCount);
    }

    /**
     * 统计动物病症数量接口
     * @return 响应信息
     */
    @GetMapping("/countDisease")
    public Result<?> countDisease(){
        Map<String, Integer> diseasedCount = service.diseaseCount();
        return Result.success(diseasedCount);
    }

    /**
     * 统计本年度12个月销售动物接口
     * @return 响应信息
     */
    @GetMapping("/countSales")
    public Result<?> countSales(){
        Map<String, List<?>> sales = service.salesCount();
        return Result.success(sales);
    }
}
